# 字典 理解为map
test_dict = {
    "name": "Alice",
    "age": 30,
    "city": "New York"
}
# 输出字典
print(test_dict)
# 访问字典中的值
print(test_dict["name"])  # 输出 Alice
# 添加新的键值对
test_dict["job"] = "Engineer"
# 输出更新后的字典
print(test_dict)  # 输出 {'name': 'Alice', 'age': 30, 'city': 'New York', 'job': 'Engineer'}
# 修改字典中的值
test_dict["age"] = 31
# 删除键值对
del test_dict["city"]
print(test_dict)
# 使用get()方法访问字典中的值
print(test_dict.get("name"))  # 输出 Alice
# 遍历字典 
for key, value in test_dict.items():
    print(f"{key}: {value}")
# 遍历字典的键
for key in test_dict.keys():
    print(key)  # 输出键